import { createApp, nextTick } from "vue";
import TimeLine from "@/components/TimeLine";
import CopyCode from "@/components/CopyCode";
import { MessageEventListener } from "@/utils/functions";
import { componentConfig } from "@/utils/nav.config";

import router from "./router";
import App from "./App.vue";
import "@/assets/iconfont/iconfont.css";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import "/public/mapbox-gl.css";
import "@/styles/index.less"
import "@/utils/rem.js"
import utils from "@/utils/utils"; // 导入api接口

const app = createApp(App);
app.config.globalProperties.$utils = utils;
app.component("TimeLine", TimeLine);
app.component("CopyCode", CopyCode);
app.use(router);
app.mount("#mainApp");
app.use(ElementPlus, { size: "small", zIndex: 3000 });


// // 接收数据
// MessageEventListener((path) => {
//   // console.log(path);
//   if (!path.includes("/") && path) {
//     return;
//   }
//   const routePath = app.config.globalProperties.$route.path; // 当前路由路径
//   const { $router } = app.config.globalProperties;
//   if (path === "/") {
//     componentConfig.some((item) =>
//       item.items.some((it) => routePath.includes(it.path))
//     ) &&
//       $router.push({
//         path: "/doc/introduce",
//       });
//   } else if (path.includes("/doc") && routePath !== path) {
//     console.log(path);

//     $router.push({
//       path,
//     });
//   }
// }, true);

